package CouponService

import (
	"gdshop-font-api-go/library/response"
	toolsDb "gdshop-font-api-go/library/tools/db"
	"github.com/gogf/gf/net/ghttp"
)

func Details(r *ghttp.Request) *response.JsonResponse {
	ctx := r.GetCtx()
	couponId := r.GetInt("coupon_id", 0)
	if couponId < 1 {
		return response.FailByRequestMessage(r, "优惠券ID不能为空")
	}
	value, err := toolsDb.GetUnSafaTable(ctx, "coupon_remark").Where("coupon_id = ?", couponId).
		Fields("remark").Value()
	if err != nil {
		return response.FailByRequestMessage(nil, err.Error())
	}

	return response.SuccessByRequestMessageData(nil, "成功", value)
}
